<?php $this->load->view('header');?>

<div class="page-container">
	<?php $this->load->view('sidebar');?>
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
					用户管理 <small>用户,群组及权限设置</small>
					</h3>
					<ul class="page-breadcrumb breadcrumb">
						<li>
							<i class="fa fa-home"></i>
							<a href="" >
								首页
							</a>
							<i class="fa fa-angle-right"></i>
						</li>
						<li>
							<a href="setting">
								用户管理
							</a>
							<i class="fa fa-angle-right"></i>
						</li>
						<li>
							<a href="system/group">
								群组管理
							</a>
						</li>
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>

			<div class="row">
				<div class="col-md-12">

					<div class="table-toolbar">
						<div class="btn-group">
							<button id="add_channel_btn" class="btn green" data-toggle="modal" data-target="#group_add_modal">
							 新增群组 <i class="fa fa-plus"></i>
							</button>
						</div>
					</div>

					<table class="table table-hover">
						<thead>
							<tr>
								<th>群组名称</th>
								<th>群组描述</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($groups as $key => $group):?>
								<tr>
									<td><a href="#" data-type="text" data-pk="<?php echo $group['id'];?>" id="name"><?php echo $group['name'];?></a></td>
									<td><a href="#" data-type="text" data-pk="<?php echo $group['id'];?>" id="description"><?php echo $group['description'];?></a></td>
									<td>
										<a data-toggle="modal" href="user/group_permission_edit/<?php echo $group['id'];?>" data-target="#power-modal" class="btn btn-info btn-xs power_btn" data-pk="<?php echo $group['id'];?>">权限管理</a>
										<a class="btn btn-danger btn-xs group_del_btn" data-title="<?php echo $group['name'];?>" data-href="group/delete" data-pk="<?php echo $group['id'];?>">删除</a>
									</td>
								</tr>
							<?php endforeach;?>
						</tbody>
					</table>

					<div class="modal fade" id="group_add_modal">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
									<h4 class="modal-title">添加群组</h4>
								</div>
								<div class="modal-body">
									<form action="" method="POST" role="form" class="form-horizontal" id="groupAddForm">
										<div class="form-group">
											<label for="" class="col-sm-3 control-label">群组名称<span class="required">*</span></label>
											<div class="col-sm-5">
												<input type="text" class="form-control" id="groupName"  placeholder="群组名称">
											</div>
										</div>
										<div class="form-group">
											<label for="" class="col-sm-3 control-label">群组描述</label>
											<div class="col-sm-7">
												<input type="text" class="form-control" id="groupDesc" data-type="text" data-pk="" placeholder="群组描述">
											</div>
										</div>										
									</form>
								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
									<button type="button" class="btn btn-primary" id="group_submit_btn">添加</button>
								</div>
							</div><!-- /.modal-content -->
						</div><!-- /.modal-dialog -->
					</div><!-- /.modal -->


					<div class="modal fade" id="power-modal">
						<div class="modal-dialog">
							<div class="modal-content">

							</div><!-- /.modal-content -->
						</div><!-- /.modal-dialog -->
					</div><!-- /.modal -->

				</div>
			</div>
	</div>
</div>

<?php $this->load->view('footer');?>

<script type="text/javascript" src="assets/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
<!-- Jquery Form -->
<script type="text/javascript" src="assets/plugins/jquery.form.js"></script>

<link rel="stylesheet" type="text/css" href="assets/plugins/jstree/dist/themes/default/style.min.css">
<script type="text/javascript" src="assets/plugins/jstree/dist/jstree.min.js"></script>
<script type="text/javascript" src="assets/scripts/custom/group.js"></script>

<script>
jQuery(document).ready(function() {    
   App.init(); // initlayout and core plugins
   Group.init();
});
</script>

</body>
<!-- END BODY -->
</html>
